home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Communications / General / LineShare Folder / Put Onto Productions Disks / LineShare Scripts / Pro⁄Ultima VoiceFaxTelefinder < prev    next >
Text File  |  1994-03-08  |  6KB  |  280 lines

  1. ! Version 2.2
  2. !
  3. !$ Use with: Prometheus Ultima Home Office modems.
  4. !
  5. !$ Supports: MaxFax voice/fax and TeleFinder
  6. !
  7. !$ In MaxFax, set "Rings till answer" to 1, "Toll Saver" to 0.
  8. !
  9. !$ To access the TeleFinder host, extend the phone number with
  10. !$ 8 commas and 1-3 "Data Link Codes" separated with commas.
  11. !
  12. !$ Sample: "555-234,,,,,,,,5,5,5".
  13.  
  14. ^2 Speaker On:        = Enum("Never" = "0","During Connect" = "1", "Always"="2") "1"
  15. ^3 Speaker Volume:       = Enum("Low"="1","Medium"="2","High"="3") "2"
  16. ^4 Answer On:         = Enum("1 Ring"="1","2 Rings"="2","3 Rings"="3","5 Rings"="5","7 Rings"="7") "2"
  17. ^5 Fax Identifier:    = Text "Stalker"
  18. ^6 Handshake wires:   = Bool("CTS/RTS"="&D0\Q3","CTS only"="&D2\Q2") "&D2\Q2"
  19. ^7 Data Line Code:    = Enum("1"="","2"="","3"="","4"="","5"="","6"="","7"="","8"="","9"="") ""
  20. ! ------------------------------------------
  21. ! Resetting the modem:
  22. ! ------------------------------------------
  23. @Hangup
  24.   Note "Resetting" 3
  25.   SetTries 2
  26.   Flush
  27.   HsReset 0,0,17,19,0,0
  28. !
  29. ! Try to catch the "OK" answer, use the Escape seq and DTR transitions
  30. ! to enter the command mode
  31. !
  32. @Label 1
  33.   matchclr
  34.   matchstr 1 2 "OK\r\n"
  35.   write "ATH0&F\r"
  36.   matchread 20
  37.   Write "+++"
  38.   DtrClear
  39.   pause 5
  40.   DtrSet
  41. !
  42.   SerReset 19200,0,8,1
  43.   DecTries
  44.   IfTries 1 1
  45.   SerReset 9600,0,8,1
  46.   IfTries 0 1
  47. !
  48. ! OSErr -6019 "Modem error - the modem is not responding"
  49. !
  50.   exit -6019
  51. @Label 2
  52.   SerReset 9600,0,8,1
  53.   write "AT+FCLASS=0\r"
  54.   Jsr 100
  55.   write "AT+FAA=0\r"
  56.   Jsr 100
  57.   Flush
  58.   Write "ATI9\r"
  59.   MatchClr
  60.   MatchStr 1 3 "\r\n^$\r\n\r\nOK\r\n" 
  61.   MatchStr 2 4 "ERROR\r\n"
  62.   MatchRead 5
  63.   Jump 4
  64. @Label 3
  65.   SetInfo 9 "^$"
  66. @Label 4
  67.   exit 0
  68.  
  69. ! ------------------------------------------
  70. !    Receiving incoming calls
  71. ! ------------------------------------------
  72. @ANSWER
  73. !
  74. ! Set the modem preferred speed first
  75. !
  76.   SerReset 19200,0,8,1
  77.   Jsr 80
  78. @Label 10
  79. !
  80. ! Set the common options
  81.   Jsr 70
  82.  
  83.   Write "AT+FAA=1\r"
  84.   Jsr 100
  85. !
  86. ! Everything is ready - let's sit and wait for a call
  87. ! We'll wait for 5 minutes, then reinitiate the modem
  88. !
  89.   Note "Waiting for a fax/voice or TeleFinder call…"
  90.   SetTries 0
  91. @Label 15
  92.   MatchClr
  93.   matchstr 1 16 "RING\r\n"
  94.   Matchread 100
  95.   IfTries 1 10
  96.   MatchRead 2900
  97.   Jump 10
  98. @Label 16
  99.   Note "Ring…"
  100.   IncTries
  101.   IfTries Val("^4") 17
  102.   Jump 15
  103. @Label 17
  104. ! A = <dle> 0x11 <digit code>
  105. ! B = 0x1F (* code)
  106. !
  107.   SetVar A "\16\17^7"
  108.   SetVar B "\31\r\nOK\r\n"
  109.   QueueInput "\r\nRING\r\n\r\nRING\r\n"
  110.   HsReset 0,1,0,0,0,0
  111.   Attach "MaxFax" (DTR,Escape,Master,Check(A,B))
  112.   Pause 5
  113. !
  114. !now abort greetings, if any in progress
  115.   Write "\16\03"
  116.   MatchClr
  117.   MatchStr 1 18 "OK\r\n"
  118.   MatchRead 40
  119. @Label 18
  120. !
  121. ! switch off voice modes
  122.   Write "AT#VS0\r"
  123.   Jsr 100
  124.   SerReset 19200,0,8,1
  125.  
  126.   Write "AT#VH0H1\r"
  127.   Jsr 100
  128.  
  129.   Write "AT+FAA=0;+FCLASS=0\r"
  130.   Jsr 100
  131. !
  132. ! Set the common options
  133.   Jsr 70
  134. !
  135. ! Set TeleFinder parameters, force to answer in the data mode
  136.   Write "AT\\N3%C1A\r"
  137.   MatchClr
  138.   MatchStr 1 20 "\r\nCONNECT ^$\r\n"
  139.   MatchStr 4 93 "NO CARRIER\r\n"
  140.   MatchStr 5 94 "NO ANSWER\r\n"
  141.   MatchRead 300
  142.   Write "\r"
  143.   Exit -6019
  144.  
  145.  
  146. @Label 20
  147.   QueueInput "\r\27CONNECT ^$\r\27"
  148.   QueueInput "\r\27RING\r\27"
  149.   Attach "TF" (DTR,Escape,Break,Reset,IdleLimit=60)
  150.  
  151. ! ------------------------------------------
  152. ! Originating a call through the "TF" subport
  153. ! ------------------------------------------
  154. @ORIGINATE "TF"
  155.   SerReset 19200,0,8,1
  156.   Jsr 80
  157. !
  158. ! Set the common options
  159. !
  160.   Jsr 70
  161. !
  162.   Jsr 60
  163. !
  164. ! Prepare to receive all error result codes, dial the number
  165. !
  166.   Jsr 90
  167.   MatchStr 1 25 "\r\nCONNECT"
  168.   MatchRead 1000
  169.   Write "\r"
  170.   Exit -6019
  171.  
  172. @Label 25
  173.   QueueInput "\r\nCONNECT"
  174.   Attach "TF" (DTR,Escape,Break,Reset)
  175.  
  176. ! ------------------------------------------
  177. ! Originating a call through the "MaxFax" subPort
  178. ! ------------------------------------------
  179. @ORIGINATE "MaxFax" ("\r\nLineShare Line is Busy\r\nBUSY\r\n")
  180. !
  181. ! Set the "Fax" speed
  182. !
  183.   SerReset 19200,0,8,1
  184.   Jsr 80
  185. !
  186. ! Set the common options
  187. !
  188.   Jsr 70
  189. !
  190. ! Set the Fax mode
  191. !
  192.   Write "AT+FCLASS=2\r"
  193.   Jsr 100
  194. !
  195. ! Now emit all commands that the application has sent to that port, except +FCLASS
  196. !
  197.   EmitClear "+FCLASS"
  198.   Jsr 60
  199. !
  200. ! Prepare to receive all error result codes, dial the number
  201. !
  202.   Jsr 90
  203.   HSReset 0 1 0 0 0 0
  204.   MatchStr 1 30 "\r\n+FCON"
  205.   MatchRead 900
  206.   Write "\r"
  207.   Exit -6019
  208. @Label 30
  209.   QueueInput "\r\n+FCON"
  210.   Attach "MaxFax" (DTR,Escape)
  211.  
  212. !
  213. ! This section emits all modem commands sent from the client application
  214. ! For each set of commands the "OK" answer is awaited
  215. !
  216. @Label 60
  217.   EmitStart
  218. @Label 61
  219.   EmitCommand 62
  220.   Jsr 100
  221.   Jump 61
  222. @Label 62
  223.   return
  224. !
  225. ! This section initiates the modem before ANSWER and ORIGINATEs:
  226. ! extended responses + connect at the highest rate + speaker control +
  227. ! reset on Dtr drop 
  228. ! Verbal responses mode, no echo 
  229. !
  230. @Label 70
  231.   Write "ATX4M^2L^3^6V1E0\r"
  232.   Jsr 100
  233.   return 
  234.  
  235. !
  236. ! This section syncronize the modem after the serial port speed switching
  237. !
  238. @Label 80
  239.   ChrDelay 1
  240.   Write "AT\r"
  241.   ChrDelay 0
  242.   Jsr 100
  243.   return
  244. !
  245. ! Prepare to receive error result codes, send the dialing command and
  246. ! set the user's handshake mode
  247. !
  248. @Label 90
  249.   MatchClr
  250.   MatchStr 2 91 "NO DIALTONE\r\n"
  251.   MatchStr 3 92 "BUSY\r\n"
  252.   MatchStr 4 93 "NO CARRIER\r\n"
  253.   MatchStr 5 94 "NO ANSWER\r\n"
  254.   Write "ATD^1\r"
  255.   HsReset *
  256.   return
  257. @Label 91
  258.   exit -6020
  259. @Label 92
  260.   exit -6022
  261. @Label 93
  262.   exit -6021
  263. @Label 94
  264.   exit -6023
  265. !
  266. ! Processing the AT command:
  267. ! OK -> proceed
  268. ! ERROR or TimeOut ->exit -6019
  269. ! It can be called AFTER the "Write" command, since LineShare buffers input
  270. !
  271. @Label 100
  272.   MatchClr
  273.   MatchStr 1 102 "\r\nOK\r\n"
  274.   MatchStr 2 101 "\r\nERROR\r\n"
  275.   MatchRead 20
  276. @Label 101
  277.   Exit -6019
  278. @Label 102
  279.   return
  280.